<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\LinkPager;

/* @var $this yii\web\View */
/* @var $model common\models\Zytopic */

$this->title = $title.'的功效與藥用價值-'.Yii::$app->params['brand'];
$title = $title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Zytopics'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $title;
?>
<div class="note-index row">
    <div class="col-md-8 br10 white">
        <h1><?= Html::encode($title) ?></h1>
        <hr>
        <?php foreach ($model as $value): ?>
            <div class="row pb">
                <div class="col-md-4">
                    <?php
                    if (!empty($value['img'])) {
                        echo '<span><a href="'.Url::to('/zhongyao/' . $value['id']).'" title="' . $value['title'] . '"><img src="'.Yii::$app->params['img_domain'].$value['img'].'" alt="'.$value['title'].'" class="list-img"></a></span>';
                    } else {
                        echo '<span><img src="'.Yii::$app->params['frontend_domain'].'/img/default.jpg" title="'.$value['title'].'"  class="list-img" /></span>';
                    }
                    ?>
                </div>
                <div class="col-md-8">
                    <h3 class="list-h3"><small>
                            <span><?= Html::a($value['title'], Url::to('/zhongyao/' . $value['id']), ['title' => $value['title']]); ?></span>
                        </small></h3>
                    <p>
                        <span class="attr" title="日期"><i class="iconfont">&#xe6f0;</i><?= date('Y-m-d H:i:s', $value['created_at']); ?></span>
                        <!--<span class="attr" title="浏览量"><i class="iconfont">&#xe6a4;</i><?//= $value['view']; ?></span>-->
                        <span title="标签"><i class="iconfont">&#xe60d;</i><?= Html::a($value['tag'], Url::to('/zytopic/' . $value['tag']), ['title' => $value['tag']]); ?></span>
                    </p>
                    <div class="description"><?= $value['desc']; ?></div>
                </div>
            </div>
        <?php endforeach; ?>
        <?=LinkPager::widget(['pagination' => $pagination]);?>
    </div>
    <div class="col-md-4 br10 white">
        <div class="row widget">
            <div class="col-md-12">
                <h2 class="widget_title"><small><i class="iconfont">&#xe639;</i>相關食材</small></h2>
                <hr>
                <?php
                foreach ($relate_type as $item) {
                    echo '<span class="widget-tag">';
                    echo Html::a($item['title'], Url::to('/zytopic/' . $item['id']), ['title' => $item['title'], 'class' => 'btn btn-default', 'role' => 'button']);
                    echo '</span>';
                }
                ?>
            </div>
        </div>
    </div>

</div>